package org.rails.extjs.ux;

import org.rails.extjs.Option;
import org.rails.extjs.toolbar.Toolbar;

public class StatusBar extends Toolbar {

	public StatusBar() {
		super();
	}

	public StatusBar(String id) {
		super(id);
	}

	public StatusBar(Option configOptions) {
		super(configOptions);
	}
	
	@Override
	public String getClassName(){
		return getString("cls","x-statusbar");
	}
	
	public void setBusyIconCls(String busyIconCls){
		addOption("busyIconCls", busyIconCls);
	}
	
	public String getBusyIconCls(){
		return getString("busyIconCls", "x-status-busy");
	}
	
	public void setBusyText(String busyText){
		addOption("busyText",busyText);
	}
	
	public String getBusyText(){
		return getString("busyText","Loading...");
	}
	
	public void setAutoClear(Integer autoClear){
		addOption("autoClear",autoClear);
	}
	
	public Integer getAutoClear(){
		return getInteger("autoClear",5000);
	}
	
	public void setEmptyText(String emptyText){
		addOption("emptyText",emptyText);
	}
	
	public String getEmptyText(){
		return getString("emptyText","&nbsp;");
	}
	
	public void setActiveThreadId(Integer activeThreadId){
		addOption("activeThreadId",activeThreadId);
	}
	
	public Integer getActiveThreadId(){
		return getInteger("activeThreadId",0);
	}
	
	public void setStatusAlign(String statusAlign){
		addOption("statusAlign",statusAlign);
	}
	
	public String getStatusAlign(){
		return getString("statusAlign","left");
	}
	
	public void setDefaultText(String defaultText){
		addOption("defaultText",defaultText);
	}
	
	public String getDefaultText(){
		return getString("defaultText","");
	}
	
	@Override
	public String getScript() {
		super.createItems();
		script = new StringBuffer("");
		script.append("new Ext.ux.StatusBar(");
		script.append(createOptions());
		script.append(")");
		return script.toString();
	}

}
